package dat01;

import java.util.Scanner;

public class Test04 {
    /**
     * 要求用户从控制台输入一个email地址，然后获取该email的用户名(@之前的内容)
     * @author Admin
     *
     */
    public static void main(String[] args) {
        String email = "";
        Scanner sc= new Scanner(System.in);
        System.out.println("请输入邮箱");
        email = sc.nextLine();
        if(email.indexOf('@') < 1){
            System.out.println("请输入正确的邮箱");
        }else {
            System.out.println(email.substring(0,email.indexOf('@')));
        }
    }
}
